<template>
  <div>
    <el-table
      border
      v-if="!loading"
      :data="tableData"
      style="width: 100%">
      <el-table-column
        prop="sname"
        label="校区名称">
      </el-table-column>
      <el-table-column
        prop="addr"
        label="校区地址">
      </el-table-column>
      <el-table-column
        prop="contact"
        label="号码">
      </el-table-column>
      <el-table-column
        prop="descp"
        label="描述">
      </el-table-column>
      <el-table-column
        label="logo">
        <template slot-scope="scope">
          <el-avatar
            shape="square"
            size="medium"
            :src="scope.row.logo"></el-avatar>
        </template>
      </el-table-column>
      <el-table-column
        width="200"
        label="操作">
        <template slot-scope="scope">
          <el-button size="mini">编 辑</el-button>
          <el-button size="mini" type="danger">删 除</el-button>
        </template>
      </el-table-column>
    </el-table>
    <tableSkeleton v-else />
  </div>
</template>

<script>
import { getSchool } from '@/api'
import tableSkeleton from '@/components/tableSkeleton'
export default {
  name: 'school',
  components:{tableSkeleton},
  data() {
    return {
      tableData:[],
      loading:true
    }
  },
  created() {
    this.getList()
  },
  methods: {
    async getList(){
      const res = await getSchool()
      this.tableData = [res.data]
      setTimeout(()=>{
        this.loading = false
      },1000)
    }
  }
}
</script>

<style scoped>

</style>
